package com.sinacom.ibuilding.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sinacom.ibuilding.beans.Role;
import com.sinacom.ibuilding.service.MemberService;

public class Constants {
	/**
	 * 政策
	 */
	public static final int NEWS_TYPE_LAW = 1;
	/**
	 * 信息
	 */
	public static final int NEWS_TYPE_INFO = 2;
	
	/**
	 * //高招
	 */
	public static final int NEWS_CAT_HIGH = 1;
	/**
	 * //中招
	 */
	public static final int NEWS_CAT_MIDDLE = 2;
	/**
	 * 初中招生
	 */
	public static final int NEWS_CAT_START = 3;
	/**
	 * 小学招生
	 */
	public static final int NEWS_CAT_PRIMARY = 4;//预留
	
	/**
	 * 幼儿园
	 */
	public static final int NEWS_CAT_CHILD = 5;//预留
	
	/**
	 * 学业考试
	 */
	public static final int NEWS_CAT_EXAM = 6;
	
	/**
	 * 中学学籍
	 */
	public static final int NEWS_CAT_ROLL_M = 7;
	
	/**
	 * 小学学籍
	 */
	public static final int NEWS_CAT_ROLL_S = 8;
	
	/**
	 * 教学信息
	 */
	public static final int NEWS_CAT_INFO = 9;
	
	/**
	 *邮件
	 */
	public static final int MSG_TYPE_EMAIL = 1;
	
	/**
	 *短信
	 */
	public static final int MSG_TYPE_SHORT = 2;
	
	/**
	 * 发件箱
	 */
	public static final int MSG_BOX_SEND = 1;
	/**
	 * 收件箱
	 */
	public static final int MSG_BOX_RECEIVE = 2;
	
	public static final int BELONG_TYPE_MSG = 1;
	public static final int BELONG_TYPE_NEWS = 2;
	
	public static final String TABLE_MESSAGE = "Message";
	public static final String TABLE_MEMBER = "Member";
	public static final String TABLE_NEWS = "News";
	public static final String TABLE_ROLE = "Role";
	public static final String TABLE_CONTACTS = "Contacts";
	public static final String TABLE_ATTACH = "Attach";
	public static final String TABLE_SCHEDULE = "Schedule";
	public static final String TABLE_SMS = "Sms";
	
	public static final boolean SEND_BACK = false;//短信是否发送到自己的手机
	public static final String PASSWORD_DEF = "111111";
	
	public static Map cacheMap = new HashMap();
	public static Map roleMap = new HashMap();
	
	static{
		MemberService memberService = new MemberService();
		List roleTree = memberService.getRoleTree("0");
		cacheMap.put("roleTree", roleTree);
		
		List roleList = memberService.getRole();
		if(roleList != null && roleList.size() > 0){
			for (int i = 0; i < roleList.size(); i++) {
				Role role = (Role) roleList.get(i);
				roleMap.put(role.getId(), role.getName());
			}
		}
		
	}
	public static String getCategoryName(String category){
		int cate = Integer.parseInt(category);
		String name = "";
		switch(cate){
			case NEWS_CAT_HIGH:{
				name = "高招信息";
				break;
			}
			case NEWS_CAT_MIDDLE:{
				name = "中招信息";
				break;
			}
			case NEWS_CAT_START:{
				name = "初中招生";
				break;
			}
			case NEWS_CAT_PRIMARY:{
				name = "小学招生";
				break;
			}
			case NEWS_CAT_CHILD:{
				name = "幼儿园";
				break;
			}
			case NEWS_CAT_EXAM:{
				name = "学业考试";
				break;
			}
			case NEWS_CAT_ROLL_M:{
				name = "中学学籍";
				break;
			}
			case NEWS_CAT_ROLL_S:{
				name = "小学学籍";
				break;
			}
			case NEWS_CAT_INFO:{
				name = "教学信息";
				break;
			}
		}
		return name;
	}
}
